package com.zcxy.sys.pojo;


import com.zcxy.mybatis.util.anotation.JoinColumn;
import com.zcxy.mybatis.util.anotation.OneToMany;
import com.zcxy.sys.entity.SysAutocode;
import com.zcxy.sys.entity.SysAutocodeItem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * 代码生成
 * 
 * @author zcc
 * @email 860474958@qq.com
 * @date 2020-09-12
 */
@Data
@ApiModel(value = "SysAutocode", description = "代码生成实体对象")
public class SysAutocodeVo   {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "包路径", required = false)
    private String packagePath;

    @ApiModelProperty(value = "*表名", required = false)
    private String tableName;

    @ApiModelProperty(value = "类名", required = false)
    private String className;

    @ApiModelProperty(value = "类名首字母小写", required = false)
    private String classNameS;


    @ApiModelProperty(value = "功能描述", required = false)
    private String comment;

    @ApiModelProperty(value = "主表的描述", required = false)
    private String relationTableDescribe;

    @ApiModelProperty(value = "主表的主键", required = false)
    private String relationKey;

    @ApiModelProperty(value = "1.单表2.左树(主表)3.右表(附表)4.主表5.附表6.树表", required = false)
    private String relationType;


    @ApiModelProperty(value = "主表id", required = false)
    private String id;

    @OneToMany(targetEntity = SysAutocodeItem.class)
    @JoinColumn(name = "id",referencedColumnName = "parent_id")
    private List<SysAutocodeItem> sysAutocodeItems;

    @ApiModelProperty(value = "1.单表2.左树(主表)3.右表(附表)4.主表5.附表6.树表", required = false)
    private String relationTypeStr;

    public String getRelationTypeStr() {
        switch (this.relationType){
            case "1": return "单表";
            case "2" :    return "左树(主表)";
            case "3": return "右表(附表)";
            case "4" :    return "主表";
            case "5": return "附表";
            case "6" :    return "树表";
            default: return "";
        }

    }


}

